<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>函数闭包</title>
</head>
<body>
<script>
    //ES5
    function getname() {
        let name = "tom";
        function names() {
            return name;
        }
        return names;
    }
    let names = getname();
    console.log(names());
//ES6
    let globe;
    {
        let name = 'jerry';
        globe = function () {
            return name;
        }
    }
    console.log(globe());
</script>
</body>
</html>